import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintStream;

/**
 * Created with IntelliJ IDEA.
 * User: thoughtworker
 * Date: 10/10/13
 * Time: 3:10 PM
 * To change this template use File | Settings | File Templates.
 */
public class UserInteraction {

    private BufferedReader reader;
    private PrintStream printer;
    private PrintMessage message;

    public UserInteraction(BufferedReader reader, PrintMessage message, PrintStream printer){
        this.reader = reader;
        this.printer = printer;
        this.message = message;

    }

    public void handleUserInput(String input) throws IOException {
        while (!input.equals("Quit")){
            message.respondToInput(input);
            input = getUserInput();
        }
    }

    public String getUserInput() throws IOException {
        printer.println("Options:");
        printer.println("View All Players, Find Player, View Team, Trade Player, Quit");
        return reader.readLine();
    }

    public void go()  throws IOException {
        String input = getUserInput();
        handleUserInput(input);
    }

}
